package com.att.action;

import com.att.bean.DepNumRunBean;
import com.att.service.DepNumRunService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("depNumRun")
public class DepNumRunAction {

    @Resource(name = "depNumRunService")
    private DepNumRunService depNumRunService;

    //新增
    @RequestMapping("insert")
    @ResponseBody
    public String insert(DepNumRunBean bean) {
        DepNumRunBean depNumRunBean = depNumRunService.findDepNumRunBean(bean);
        if(depNumRunBean == null){
            boolean flag = depNumRunService.insert(bean);
            if(flag){
                return "SUCCESS";
            }
        }else {
            boolean flag = depNumRunService.update(bean);
            if(flag){
                return "SUCCESS";
            }
        }
        return "ERROR";
    }

//    /**
//     * Description: 带条件查询出勤记录
//     * @param bean
//     */
//    @RequestMapping("selectAll")
//    @ResponseBody
//    public Object selectAll(UserOfRunBean bean) {
//        List<UserOfRunBean> list = userOfRunService.findByCondition(bean);
//        return LayuiUtil.data(0L, list);
//    }
}
